//
//  LoginViewController.swift
//  CDLiftWithDisplay
//
//  Created by SteveLi on 2017/9/18.
//  Copyright © 2017年 李军桦. All rights reserved.
//

import UIKit

class LoginViewController: UIViewController {
    
    
    @IBOutlet weak var nameText: UITextField!
    
    @IBOutlet weak var passwordText: UITextField!

    override func viewDidLoad() {
        super.viewDidLoad()

       
    }
    
    @IBAction func loginBtn(_ sender: Any) {
        if self.nameText.text == "admin" && self.passwordText.text == "123456"{
            
        
            let tabbarVc = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
            UIApplication.shared.keyWindow?.rootViewController = tabbarVc
 
            
        }else{
            let alertController = UIAlertController(title: "系统提示",
                                                    message: "用户名或密码错误", preferredStyle: .alert)
            let backAction = UIAlertAction(title: "返回", style: .cancel, handler: nil)
            alertController.addAction(backAction)
            self.present(alertController, animated: true, completion: nil)
        }

        
        
    }
    
    
    

    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
//        let tabbarVc = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
//      UIApplication.shared.keyWindow?.rootViewController = tabbarVc
        
        print("999")
    
    }
   

}
